
_realname=suil
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.10.20
pkgrel=1
pkgdesc="A lightweight C library for loading and wrapping LV2 plugin UIs (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://drobilla.net/software/suil.html"
msys2_repository_url="https://gitlab.com/lv2/suil/"
msys2_documentation_url="https://drobilla.net/docs/suil/"
msys2_references=(
  'archlinux: suil'
)
license=("spdx:0BSD OR ISC")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-cc"
  "${MINGW_PACKAGE_PREFIX}-meson"
  "${MINGW_PACKAGE_PREFIX}-pkgconf"
  "${MINGW_PACKAGE_PREFIX}-gtk2"
  "${MINGW_PACKAGE_PREFIX}-gtk3"
  "${MINGW_PACKAGE_PREFIX}-qt5-base"
)
depends=("${MINGW_PACKAGE_PREFIX}-lv2")
optdepends=(
  "${MINGW_PACKAGE_PREFIX}-glib2: Support for wrapping Qt5 in GTK3 and GTK2"
  "${MINGW_PACKAGE_PREFIX}-gtk2: Support for wrapping Qt5 in GTK2 and GTK2 in Qt5"
  "${MINGW_PACKAGE_PREFIX}-gtk3: Support for wrapping Qt5 in GTK3"
  "${MINGW_PACKAGE_PREFIX}-qt5-base: support for wrapping Qt5 in GTK3 and GTK2"
)
source=("https://download.drobilla.net/${_realname}-${pkgver}.tar.xz"{,.sig})
sha256sums=('334a3ed3e73d5e17ff400b3db9801f63809155b0faa8b1b9046f9dd3ffef934e'
            'SKIP')
validpgpkeys=('907D226E7E13FA337F014A083672782A9BF368F3') # David Robillard <d@drobilla.net>

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  ${MINGW_PREFIX}/bin/meson.exe setup \
    --buildtype=plain \
    --auto-features=enabled \
    --prefix=${MINGW_PREFIX} \
    -Dcocoa=disabled \
    -Dx11=disabled \
    -Ddocs=disabled \
    ../${_realname}-${pkgver}

  ${MINGW_PREFIX}/bin/meson.exe compile
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  ${MINGW_PREFIX}/bin/meson.exe install --destdir="${pkgdir}"

  install -vDm 644 "${srcdir}"/${_realname}-${pkgver}/COPYING -t "${pkgdir}${MINGW_PREFIX}/share/licenses/$_realname/"
  install -vDm 644 "${srcdir}"/${_realname}-${pkgver}/{AUTHORS,NEWS,README.md} -t "${pkgdir}${MINGW_PREFIX}/share/doc/$_realname/"
}
